// 思路就是贪心算法，太看基础了，紧张了就没搞完，唉~

public class tt{
    // 硬币选取问题，贪心思想
    public static int[] method(int[] coins, int[] counts, int num){
        int[] change = new int[coins.length]; //存储找零的硬币数量
        int remain = num;

        for(int i = 0; i < coins.length; i++){
            int coin = coins[i];
            int count = counts[i];
            int num1 = Math.min(remain/coin, count);
            change[i] = num1; //记录的使用后的硬币数量
            remain -= num1*coin;
        }
        return change;
    }

    public static void main(String[] args){
        int[] coins = {100, 50, 10, 5, 1};
        int[] counts = {4, 8, 20, 4, 20};
        int a = 660;
        int[] change =method(coins, counts, a);
        for(int i = 0; i < coins.length; i++){
            System.out.println(coins[i]/100.0 + " " +  change[i]);
        }
    }

}